package com.droid.mvvmlib.concurrent;

import com.droid.base.concurrent.Promise;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;

/**
 * submit runnable in background
 */
public class SubmitHelper {
    public static Future<?> submit(Runnable runnable) {
        return GlobalExecutor.getInstance().submit(runnable);
    }

    public static <T> Promise<T> submit(Callable<T> runnable) {
        return Promise.supplyAsync(runnable, GlobalExecutor.getInstance());
    }
}
